BUGFIX: accept tabindex="-1" in template-require-aria-activedescendant-tabindex#2714
Merged
NullVoxPopuli merged 1 commit intoember-cli:masterfrom Apr 21, 2026
Conversation
…="-1"
Before: any tabindex below 0 was flagged, and the autofix replaced
tabindex="-1" with tabindex="0". That silently changed semantics — -1 is
the canonical "focusable but not in tab order" value that composite
widgets with aria-activedescendant specifically want.
tabindex semantics:
"0" — focusable, in the natural tab order
"-1" — focusable programmatically (e.g. via roving focus), skipped in
tab order
Both are valid for elements that manage focus via aria-activedescendant;
see the W3C APG entry on "Managing focus in composites using
aria-activedescendant":
https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant
Matches the check upstream in eslint-plugin-jsx-a11y
(aria-activedescendant-has-tabindex.js: `if (tabIndex >= -1) return;`).
lit-a11y's aria-activedescendant-has-tabindex has the same semantics.
Rule doc updated to describe the new accepted range. Tests moved the
three tabindex="-1" cases from invalid to valid.
NullVoxPopuli
approved these changes
Apr 21, 2026
This was referenced Apr 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tabindex="0"puts an element in the natural tab order;tabindex="-1"makes it programmatically focusable but skipped by Tab.aria-activedescendantexplicitly treats both values as valid —-1is the canonical choice for widgets managed via roving focus.tabindex="-1"on an element witharia-activedescendantshould not be flagged. The current rule does flag it and autofixes totabindex="0", silently moving the element into the tab order.Fix: extend the accepted range from
>= 0to>= -1. Matcheseslint-plugin-jsx-a11y(aria-activedescendant-has-tabindex.js:if (tabIndex >= -1) return;) andeslint-plugin-lit-a11y.Three test cases moved from
invalidtovalid; rule doc updated to describe the new accepted range.Upstream
[email protected]has the same false positive.